package com.app.bd;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DbHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "bares_show.db";
    public static final String TABLE_NAME_BARES = "bares";
    public static final String TABLE_NAME_SHOWS = "shows";
	private static final int DATABASE_VERSION = 1;
	public static final String id = "_id";
	public static final String nome = "nome";
	public static final String endereco="endereco";
	public static final String desc_p = "desc_p";
	public static final String logotipo = "logotipo";
	public static final String descricao = "descricao";
	public static final String horarios = "horarios"; 
	public static final String fone = "fone";
	public static final String email = "email";
	public static final String site = "site";
	public static final String tw = "tw";
	public static final String fb = "fb";
	public static final String foursquare = "foursquare";
	
	private static final String DATABASE_CREATE_BARES = "create table "
	+ TABLE_NAME_BARES + "( " + id
	+ " integer primary key autoincrement, " + nome
	+ " text not null, " + endereco + " text not null, "
	+ desc_p+" text not null, "+logotipo+" text not null, "+descricao+" text not null, "
	+horarios+" text not null, "+fone+" text not null, "+email+" text not null, "
	+site+" text not null, "+tw+" text not null, "+fb+" text not null, "+foursquare+" text not null);";
			
	public DbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
	       db.execSQL(DATABASE_CREATE_BARES);
	       System.out.println("Tabela");
	}
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	      db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_BARES);
	      onCreate(db);
	}
	
}
